<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点击测试</title>
    <style>
        body {
            margin: 0;
            padding: 20px;
            font-family: Arial, sans-serif;
        }
        .test-container {
            max-width: 800px;
            margin: 0 auto;
        }
        .test-item {
            padding: 20px;
            margin: 10px 0;
            border: 2px solid #ddd;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .test-item:hover {
            border-color: #007bff;
            background-color: #f8f9fa;
        }
        .test-item.clicked {
            border-color: #28a745;
            background-color: #d4edda;
        }
        .log {
            background: #f8f9fa;
            border: 1px solid #ddd;
            padding: 15px;
            margin-top: 20px;
            border-radius: 4px;
            max-height: 300px;
            overflow-y: auto;
        }
    </style>
</head>
<body>
    <div class="test-container">
        <h1>🔧 点击事件测试</h1>
        <p>这个页面用于测试点击事件是否正常工作。点击下面的测试项目：</p>
        
        <div class="test-item" data-type="newspaper" data-id="1">
            <h3>📰 测试报纸 1</h3>
            <p>点击这里测试报纸点击事件</p>
        </div>
        
        <div class="test-item" data-type="newspaper" data-id="2">
            <h3>📰 测试报纸 2</h3>
            <p>点击这里测试报纸点击事件</p>
        </div>
        
        <div class="test-item" data-type="newspaper" data-id="3">
            <h3>📰 测试报纸 3</h3>
            <p>点击这里测试报纸点击事件</p>
        </div>
        
        <div class="log" id="log">
            <strong>📋 点击日志：</strong><br>
        </div>
        
        <div style="margin-top: 20px;">
            <button onclick="clearLog()">清除日志</button>
            <button onclick="goToNewspaperDetail()">前往报纸详情页</button>
            <button onclick="goBack()">返回3D展厅</button>
        </div>
    </div>

    <script>
        const log = document.getElementById('log');
        
        function addLog(message) {
            const time = new Date().toLocaleTimeString();
            log.innerHTML += `<div>[${time}] ${message}</div>`;
            log.scrollTop = log.scrollHeight;
        }
        
        function clearLog() {
            log.innerHTML = '<strong>📋 点击日志：</strong><br>';
        }
        
        function goToNewspaperDetail() {
            addLog('🔄 跳转到报纸详情页面...');
            setTimeout(() => {
                window.location.href = '/newspaper-detail';
            }, 500);
        }
        
        function goBack() {
            addLog('🔄 返回3D展厅...');
            setTimeout(() => {
                window.location.href = '/';
            }, 500);
        }
        
        // 添加点击事件监听器
        document.querySelectorAll('.test-item').forEach(item => {
            item.addEventListener('click', function(event) {
                const type = this.dataset.type;
                const id = this.dataset.id;
                
                addLog(`✅ 点击了${type} ${id}`);
                
                // 添加视觉反馈
                this.classList.add('clicked');
                setTimeout(() => {
                    this.classList.remove('clicked');
                }, 1000);
                
                // 模拟跳转延迟
                setTimeout(() => {
                    addLog(`🔄 准备跳转到报纸详情页面...`);
                    goToNewspaperDetail();
                }, 1000);
            });
        });
        
        // 页面加载完成
        document.addEventListener('DOMContentLoaded', function() {
            addLog('📄 测试页面加载完成');
            addLog('👆 请点击上面的测试项目');
        });
    </script>
</body>
</html>
